package com.shuoyue.ycgk.ui.account;

import com.shuoyue.ycgk.base.BaseModel;
import com.shuoyue.ycgk.base.BasePresenter;
import com.shuoyue.ycgk.base.BaseResult;
import com.shuoyue.ycgk.base.BaseView;
import com.shuoyue.ycgk.entity.UserInfo;
import com.shuoyue.ycgk.net.RetrofitClient;
import com.shuoyue.ycgk.net.base.ApiSubscriber;
import com.shuoyue.ycgk.net.exception.NetErrorException;
import com.shuoyue.ycgk.net.gsondefaultadapter.Optional;

import io.reactivex.Observable;

public interface UnregistContract {
    class Model extends BaseModel {


        public Observable<BaseResult<String>> unregist(
                String code) {
            return RetrofitClient.getInstance().getApi().unregist(code);
        }
    }

    interface View extends BaseView {

        void unregistSuc();

    }

    class Presenter extends BasePresenter<View> {
        private Model model = new Model();


        public void unregist(String code) {
            apply(model.unregist(code))
                    .subscribe(new ApiSubscriber<Optional<String>>(mView, this, true) {
                        @Override
                        public void onNext(Optional<String> stringOptional) {
                            super.onNext(stringOptional);
                            mView.unregistSuc();
                        }
                    });

        }


    }


}
